local qinglong = fk.CreateSkill{
  name = "hx__azure_dragon&"
}

Fk:loadTranslationTable{
  ["hx__azure_dragon&"] = "青龙",
  [":hx__azure_dragon&"] = "回合开始时，你可以弃置两张牌，弃置你判定区里的一张【乐不思蜀】或【兵粮寸断】。"
}

qinglong:addEffect(fk.TurnStart, {
  anim_type = "control",
  can_trigger = function (self, event, target, player, data)
    return player == target and player:hasSkill(qinglong.name) and player:getMark("@!!azure_dragon") > 0 and table.find(player:getCardIds(Player.Judge), function (cid)
      return Fk:getCardById(cid).name == "indulgence" or Fk:getCardById(cid).name == "supply_shortage"
    end)
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local discards = room:askToDiscard(player, {
      max_num = 2,
      min_num = 2,
      include_equip = true,
      skill_name = qinglong.name,
      skip = true
    })
    if #discards > 0 then
      event:setCostData(self, {cards = discards})
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local cards = event:getCostData(self).cards
    local discards = table.filter(player:getCardIds(Player.Judge), function (cid)
      return Fk:getCardById(cid).name == "indulgence" or Fk:getCardById(cid).name == "supply_shortage"
    end)
    local discard
    local room = player.room

    room:throwCard(cards, qinglong.name, player)
    if #discards == 1 then
      discard = discards[1]
    else
      discard = room:askToChooseCard(player, {
        target = player,
        flag = {card_data = {{"JudgeSlot", discards}}},
        skill_name = qinglong.name 
      })
    end
    room:throwCard(discard,qinglong.name, player)
    room:removePlayerMark(player, "@!!azure_dragon", 1)
    if player:getMark("@!!azure_dragon") == 0 then
      player:loseFakeSkill(qinglong.name)
    end
  end
})

return qinglong